package com.jp.fm.data;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.GregorianCalendar;
import java.util.List;

import org.junit.Test;

public class TransactionTest {

	@Test
	public final void testCompareTo() {

		List<Transaction> list = new ArrayList<Transaction>();

		Category c = new Category(0, "cat1");
		Calendar cal1 = new GregorianCalendar(2013, 1, 1);
		Calendar cal2 = new GregorianCalendar(2013, 0, 1);
		Transaction t1 = new Transaction(cal1.getTime(), 0, "test1",
				Float.valueOf("1"), c, "ext1", "desc1", false, null);
		Transaction t2 = new Transaction(cal2.getTime(), 1, "test1",
				Float.valueOf("1"), c, "ext1", "desc1", false, null);
		Transaction t3 = new Transaction(cal2.getTime(), 2, "test1",
				Float.valueOf("1"), c, "ext1", "desc1", false, 1);

		list.add(t2);
		list.add(t1);
		list.add(t3);

		Collections.sort(list);

		System.out.println(list);
	}
}
